home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / vms / VMS-INSTALL-LIBGXX.COM < prev    next >
Text File  |  1992-11-09  |  11KB  |  327 lines

  1.  
  2. $! this command procedure calls make_libgxx to build libg++, and then installs
  3. $! it on a VMS system.  It is assumed that
  4. $! GNU-C and GNU-C++ have already been installed.  It is also assumed that the
  5. $! sharable library will be used.  In order to run this you will need to have
  6. $! write access to GNU_CC:[000000]
  7. $!
  8. $! this hack lets us submit this file directly to a queue, without having to 
  9. $! specify the default directory - it assumes that the file is in the [.vms]
  10. $! directory of the tree
  11. $flnm = f$enviroment("PROCEDURE")    ! get current procedure name
  12. $set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
  13. $!
  14. $! do some simple tests first...
  15. $ if f$trnlnm("GNU_CC").eqs."" then goto errmess1
  16. $ if f$trnlnm("GNU_GXX_INCLUDE").eqs."" then goto errmess2
  17. $on error then exit
  18. $ create gnu_cc:[000000]write_test.tmp
  19. $delete/nolog gnu_cc:[000000]write_test.tmp;
  20. $!
  21. $!
  22. $!  First we use a crude  hack to rename header files in
  23. $!  the case that there exist two different files in a case-sensitive
  24. $!  world, which become one file in a case insensitive world.
  25. $!
  26. $! This will fix things so they look like:
  27. $! #ifdef VMS
  28. $! #include <rregex.h>
  29. $! #else
  30. $! #include <Regex.h>
  31. $! #endif
  32. $!
  33. $call fix_file "[-.src]Regex.cc" "RRegex.cc"
  34. $!
  35. $call fix_file "[-.src]Regex.h" "RRegex.h"
  36. $call fix_file "[-.src]String.h" "SString.h"
  37. $call fix_file "[-.src]Complex.h" "CComplex.h"
  38. $!
  39. $fix_includes:=EDIT/TPU/NODISPLAY/NOJOURNAL/NOSECTION -
  40.     /COMMAND=sys$disk:[]vms_fixincludes.tpu
  41. $!
  42. $fix_includes [-.src]RRegex.cc
  43. $fix_includes [-.src]SString.h
  44. $fix_includes [-.src]String.cc
  45. $fix_includes [-.src]strclass.h
  46. $fix_includes [-.src]complex.h
  47. $fix_includes [-.src]Complex.cc
  48. $fix_includes [-.tests]TComplex.cc
  49. $fix_includes [-.tests]TString.cc
  50. $fix_includes [-.tests]Test_H.cc
  51. $
  52. $!
  53. $! We must rename these so that the g++ compiler implements the classes.
  54. $!
  55. $if f$search("[-.src]Complex.cc").nes."" then -
  56. $    rename [-.src]Complex.cc [-.src]CComplex.cc
  57. $if f$search("[-.src]String.cc").nes."" then -
  58. $    rename [-.src]String.cc [-.src]SString.cc
  59. $!
  60. $!*************************************************************************
  61. $! Next we install the header files in the directory GNU_CC:[GXX_INCLUDE]
  62. $!*************************************************************************
  63. $!
  64. $! this is the easiest way of installing the header files.
  65. $ copy _g_config.h gnu_gxx_include:[000000]
  66. $! backup [-.g__-include...]*.*; gnu_gxx_include:[000000...]*.*;
  67. $ backup [-.iostream]*.h; gnu_gxx_include:[000000]*.*;
  68. $ backup [-.src]*.h; gnu_gxx_include:[000000]*.*;
  69. $ backup [-.src.gen...]*.*; gnu_gxx_include:[gen...]*.*;
  70. $!
  71. $!  There are some header files that are called in libg++ and the test 
  72. $! suite for which an empty file works.  Create these if needed.
  73. $if f$search("gnu_cc_include:[000000]malloc.h").eqs."" then -
  74. $    create gnu_cc_include:[000000]malloc.h
  75. $if f$search("gnu_cc_include:[000000]fcntl.h").eqs."" then -
  76. $    create gnu_cc_include:[000000]fcntl.h
  77. $if f$search("gnu_cc_include:[000000]grp.h").eqs."" then -
  78. $    create gnu_cc_include:[000000]grp.h
  79. $if f$search("gnu_cc_include:[000000]pwd.h").eqs."" then -
  80. $    create gnu_cc_include:[000000]pwd.h
  81. $if f$search("gnu_cc_include:[sys]times.h").eqs."" then -
  82. $    create gnu_cc_include:[sys]times.h
  83. $if f$search("gnu_cc_include:[sys]signal.h").eqs."" then -
  84. $    create gnu_cc_include:[sys]signal.h
  85. $if f$search("gnu_cc_include:[sys]wait.h").eqs."" then -
  86. $    create gnu_cc_include:[sys]wait.h
  87. $if f$search("gnu_cc_include:[sys]resource.h").eqs."" then -
  88. $    create gnu_cc_include:[sys]resource.h
  89. $if f$search("gnu_cc_include:[sys]resourcetime.h").eqs."" then -
  90. $    create gnu_cc_include:[sys]resourcetime.h
  91. $if f$search("gnu_cc_include:[sys]socket.h").eqs."" then -
  92. $    create gnu_cc_include:[sys]socket.h
  93. $!
  94. $get_makefile:=edit/tpu/nojournal/nosection/nodisplay/command=sys$input
  95. $get_makefile
  96.    PROCEDURE makefile_lookup (TAG_NAME, outfile)
  97.         position (beginning_of (newbuffer));
  98.         recursive_fetch_tag (TAG_NAME);
  99. !
  100. ! Now fix up a few things in the output buffer
  101. !
  102.     pat_replace (".o ",",");
  103.     pat_replace (".o","");  !appear at end of lines.
  104. !
  105. ! Remove trailing commas, if present.
  106. !
  107.     position (beginning_of (newbuffer));
  108.     LOOP
  109.       range1:=search_quietly("," & ((SPAN(" ") & LINE_END) | LINE_END), FORWARD, EXACT);
  110.       exitif range1 = 0;
  111.       position (beginning_of (range1));
  112.       erase(range1);
  113.       split_line;        
  114.       ENDLOOP;
  115. ! get rid of leading spaces on lines.
  116.         position (beginning_of (current_buffer)) ;
  117.     LOOP
  118.           range1 := search_quietly ( LINE_BEGIN & " ", FORWARD, EXACT) ;
  119.       EXITIF range1 = 0;
  120.       position (end_of (range1));
  121.       erase_character(1);
  122.     ENDLOOP;       
  123. !
  124. ! Now write the output file.
  125. !
  126.     SET(OUTPUT_FILE, newbuffer, outfile);
  127.       write_file (newbuffer);
  128.       erase (newbuffer);
  129.    ENDPROCEDURE;
  130.  
  131. !
  132. ! Looks up a tag, copies it to newbuffer, and then translates any $(...)
  133. ! definitions that appear.  The translation is put at the current point.
  134. !
  135.    PROCEDURE recursive_fetch_tag (TAG_N);
  136.    fetch_tag (TAG_N);
  137. !
  138. ! substitute any  makefile symbols $(...)
  139. !
  140.         position (beginning_of (current_buffer)) ;
  141.     LOOP
  142.           range1 := search_quietly ("$(" &  
  143.          SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789") & ")", FORWARD, EXACT) ;
  144.       EXITIF range1 = 0;
  145.       position (beginning_of (range1));
  146.       move_horizontal(2);
  147.       mark_1 := MARK (NONE);
  148.       position (end_of (range1));
  149.       move_horizontal(-1);
  150.       mark_2 := MARK (NONE);
  151.       tag_range := CREATE_RANGE(MARK_1, MARK_2, NONE);
  152.       position (end_of (range1));
  153.       tag_string := STR (tag_range);
  154.       erase (range1);
  155.       fetch_tag (LINE_BEGIN & tag_string & ((SPAN(" ") & "=") | "="));
  156.           position (beginning_of (current_buffer)) ;
  157.     ENDLOOP;       
  158.    ENDPROCEDURE;
  159.  
  160. !
  161. ! Looks up the translation of a tag, and inserts it at the current location
  162. ! in the buffer
  163. !
  164.    PROCEDURE fetch_tag (TAG_N);
  165.       LOCAL mark1, mark2, mark3, range2;
  166.       mark3 := MARK(NONE) ;
  167.       position (beginning_of (mainbuffer)) ;
  168.       range2 := search_quietly (TAG_N, FORWARD, EXACT) ;
  169.       IF (range2 = 0) then 
  170.     position (mark3);
  171.     return;
  172.     endif;
  173.       position (end_of (range2)) ;
  174.       MOVE_HORIZONTAL(1);
  175.       mark1 := MARK(NONE) ;
  176.       position (beginning_of (range2)) ;
  177.       MOVE_VERTICAL(1);
  178.       MOVE_HORIZONTAL(-2);
  179.       LOOP
  180.     EXITIF CURRENT_CHARACTER <> "\" ;
  181.     ERASE_CHARACTER(1);
  182.     MOVE_HORIZONTAL(1);
  183.     MOVE_VERTICAL(1);
  184.     MOVE_HORIZONTAL(-2);
  185.     ENDLOOP;
  186.       MOVE_HORIZONTAL(1);
  187.       mark2 := MARK(NONE) ;
  188.       range2 := CREATE_RANGE(mark1, mark2, NONE) ;
  189.       position (mark3);
  190.       if (length(range2) = 0) then return; endif;
  191.       copy_text(range2);
  192.    ENDPROCEDURE;
  193.  
  194.    PROCEDURE pat_replace (
  195.       oldstring, !
  196.       newstring)  !
  197.       LOCAL range2;
  198.       position (beginning_of (current_buffer)) ;
  199.       LOOP
  200.          range2 := search_quietly (oldstring, FORWARD, EXACT) ;
  201.          EXITIF range2 = 0 ;
  202.          position (beginning_of (range2)) ;
  203.          erase (range2) ;
  204.          copy_text (newstring) ;
  205.          ENDLOOP ;
  206.    ENDPROCEDURE ;
  207.  
  208. !
  209. ! this is the start of the main procedure.
  210. !
  211. ! First get the iostream makefile, and find out which components we need to 
  212. ! install.
  213. !
  214.    filename := GET_INFO (COMMAND_LINE, 'file_name') ;
  215.    mainbuffer := CREATE_BUFFER ("iostream.in", "[-.iostream]Makefile.in") ;
  216.    newbuffer := CREATE_BUFFER("outfile");
  217.  
  218.    makefile_lookup(LINE_BEGIN & "IOSTREAM_OBS" & ((SPAN(" ") & "=") | 
  219.         "="),"iostream-objs.list");
  220.    erase(mainbuffer);
  221.    delete(mainbuffer);
  222. !
  223. ! Now do the same thing with the [-.src]Makefile.in
  224. !
  225.    mainbuffer := CREATE_BUFFER ("src.in", "[-.src]Makefile.in") ;
  226.    position (beginning_of(mainbuffer));
  227. !
  228. ! Ooooooo I wish VMS were case sensitive like Unix was.  This a a really 
  229. ! gross hack.
  230. !
  231.    pat_replace (" Regex.o"," RRegex.o");
  232.    pat_replace (" Complex.o"," CComplex.o");
  233.    pat_replace (" String.o"," SString.o");
  234.    makefile_lookup(LINE_BEGIN & "OBJS" & ((SPAN(" ") & "=") | "="),
  235.         "src-objs.list");
  236.    quit ;
  237. !
  238. $! next build the actual library.  This will copy the result to gnu_cc:[000000]
  239. $@vms-build-libgxx
  240. $!
  241. $! next install the files for container classes.
  242. $copy genclass.* GNU_CC:[000000]*.*
  243. $!
  244. $! now install the options files required for linking.
  245. $ copy options_shr.opt GNU_CC:[000000]*.*
  246. $! copy options.opt GNU_CC:[000000]*.*   !only required to link non-shared lib
  247. $!
  248. $! now install the command files required to link a user program to the library
  249. $!
  250. $copy cxshare.com GNU_CC:[000000]*.*
  251. $!copy cxlink.com GNU_CC:[000000]*.*  !used to link to non-shared library.
  252. $!
  253. $write sys$output "The installation is complete"
  254. $exit 1
  255. $!
  256. $!
  257. $errmess1:
  258. $say:=write sys$output
  259. $ say "You must install GNU-C and then GNU-C++ before you attempt to build"
  260. $ say "libg++.  After you have installed GNU-C and GNU-C++ you can try this"
  261. $ say "again."
  262. $exit 0
  263. $!
  264. $errmess2:
  265. $ say "You must install GNU-C++ before you attempt to build"
  266. $ say "libg++.  After you have installed GNU-C++ you can try this again."
  267. $exit 0
  268. $!
  269. $type sys$input
  270. You must have write access to GNU_CC to do this installation.  If
  271. you wish, you can create your own private directory, and use a logical
  272. to point to it.  An example would be:
  273.     ASSIGN DUA0:[FRED.GNU.]+F$TRNLNM("GNU_CC") GNU_CC
  274. and any files created by this installation will be put in dua0:[fred.gnu]
  275. $exit 0
  276. $!
  277. $exit
  278. $!
  279. $!
  280. $!
  281. $!*************************************************************************
  282. $! What follows are a series of subroutines used to install libg++
  283. $!*************************************************************************
  284. $!
  285. $!
  286. $fix_file:
  287. $subroutine
  288. $!
  289. $! First locate the file that needs to be renamed.
  290. $!
  291. $epos = f$length(p1) - 1
  292. $fix_loop:
  293. $if f$extract(epos,1,p1).eqs."." then goto fix_loop_done
  294. $epos=epos-1
  295. $if epos.ge.0 then goto fix_loop
  296. $write sys$error "Ooops"
  297. $exit
  298. $!
  299. $fix_loop_done:
  300. $ name = p1
  301. $ extension = ""
  302. $ if epos.ne.f$length(p1) then name = f$extract(0,epos,p1)
  303. $ if epos.ne.f$length(p1) then extension = f$extract(epos,255,p1)
  304. $epos = f$locate("]",name)
  305. $ if epos.ne.f$length(name) then name = f$extract(epos+1,255,name)
  306. $!
  307. $write sys$output name
  308. $target = name+"_h"
  309. $if extension.nes.".h" then target=name+".h"
  310. $assign nla0: sys$output
  311. $assign nla0: sys$error
  312. $fix_loop:
  313. $flnm=f$search("''p1';*")
  314. $if flnm.eqs."" then exit
  315. $search 'flnm' "''target'"/exact
  316. $if $status.ne.1 then goto fix_loop
  317. $!
  318. $! Now rename the header file...
  319. $!
  320. $deassign sys$output
  321. $deassign sys$error
  322. $jpos = f$locate("]",flnm) + 1
  323. $flnm1 = f$extract(0,jpos,flnm) + p2
  324. $write sys$output "rename "+flnm+" "+flnm1
  325. $rename 'flnm' 'flnm1'
  326. $endsubroutine
  327.